const path = require("path");
module.exports = {
    publicPath: './',
    lintOnSave: false,
    outputDir: 'dist',
	productionSourceMap: false,
    chainWebpack: config => {
		// 删除预加载
		config.plugins.delete('preload');
		config.plugins.delete('prefetch');
		// 压缩代码
		config.optimization.minimize(true);
		// 分割代码
		config.optimization.splitChunks({
			chunks: 'all'
		})
        config.resolve.alias
            .set("@", path.resolve("src"))
            .set("@assets", path.resolve("src/assets"))
            .set("@views", path.resolve("src/views"))
            .set("@components", path.resolve("src/components"))
            .set("@utils", path.resolve("src/assets/utils"));
    },
    devServer: {
        // host: '',//target host
        port: 8665,
        proxy: {
            '/api': {
                // target: 'http://localhost:8080',//代理地址，这里设置的地址会代替axios中设置的baseURL
                target: 'http://cm-back-test.ciftis.org.cn',//代理地址，这里设置的地址会代替axios中设置的baseURL
                changeOrigin: true,// 如果接口跨域，需要进行这个参数配置
                //ws: true, // proxy websockets
                //pathRewrite方法重写url
                pathRewrite: {
                    '^/api': '/api'
                }
            }
        }
    },

}